import { getPatientMedicineOrderDetailAPI } from '@/apis/medicine'
import type { MedicineOrderDetail } from '@/types/medicine'
import { ref } from 'vue'

/**
 * 获取订单详情
 */
export const useOrderDetail = (orderId: string) => {
  const orderDetail = ref<MedicineOrderDetail>()

  // 获取订单详情
  const loadOrderDetail = async () => {
    if (!orderId) return
    const res = await getPatientMedicineOrderDetailAPI(orderId)
    orderDetail.value = res.data
    console.log('res', res.data)
    console.log('orderDetail', orderDetail.value)
  }
  loadOrderDetail()
  return {
    orderDetail,
  }
}
